/*-------------------------------------------------------------------------
 *
 * prs2lock.h
 *	  POSTGRES 规则系统 II 的数据结构（仅限重写规则）
 *
 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/rewrite/prs2lock.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef PRS2LOCK_H
#define PRS2LOCK_H

#include "access/attnum.h"
#include "nodes/pg_list.h"

/*
 * RewriteRule -
 *	  持有重写规则的信息
 *
 */
typedef struct RewriteRule
{
	Oid			ruleId;
	CmdType		event;
	Node	   *qual;
	List	   *actions;
	char		enabled;
	bool		isInstead;
} RewriteRule;

/*
 * RuleLock -
 *	  应用于特定关系的所有规则。尽管我们只
 *	  保留了重写规则系统，这些实际上并不是“锁”，
 *	  但出于历史原因保留了这个名称。
 */
typedef struct RuleLock
{
	int			numLocks;
	RewriteRule **rules;
} RuleLock;

#endif							/* PRS2LOCK_H */
